package acm.pta15;


import java.util.Scanner;

public class 机工士姆斯塔迪奥 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        int q = sc.nextInt();
        boolean[] col = new boolean[n + 1];
        boolean[] row = new boolean[n + 1];
        int rows = 0;
        int cols = 0;
        for (int i = 0; i < q; i++) {
            boolean type = sc.nextInt() == 0;
            int op = sc.nextInt();
            if (type) {
                if (!row[op]) {
                    rows++;
                    row[op] = true;
                }
            } else {
                if (!col[op]) {
                    cols++;
                    col[op] = true;
                }
            }
        }
        int ans =n * m -(rows * m + cols * (n - rows));
        System.out.println(ans);
    }
}
